package com.whut.cristiano.autographbook.Util;

import com.whut.cristiano.autographbook.MyApplication;

/**
 * Created by ykbboom on 2017/3/4 17:13
 * email：ykbpro@whut.edu.cn
 */

public class SharedPrefUtil {
    private static final String USER_NAME = "1";
    private static final String USER_PHONE = "2";
    private static final String USER_SCHOOL = "3";
    private static final String USER_PHOTO = "4";
    private static final String LOGIN_STATE = "5";
    private static final String TEMPLATE_ONE_PICURL = "6";
    private static final String USER_PHOTO_TEMP = "7";
    private static final String CHOOSE_COLOR = "8";


    public static void saveUserName(String userName){
        MyApplication.getEditor().putString(USER_NAME,userName).apply();
    }
    public static String getUserName(){
        return MyApplication.getSharedPreferences().getString(USER_NAME,"");
    }
    public static void saveUserSchool(String userSchool){
        MyApplication.getEditor().putString(USER_SCHOOL,userSchool).apply();
    }
    public static String getUserSchool(){
        return MyApplication.getSharedPreferences().getString(USER_SCHOOL,"");
    }
    public static void saveUserPhoto(String userPhoto){
        MyApplication.getEditor().putString(USER_PHOTO,userPhoto).apply();
    }
    public static String getUserPhoto(){
        return MyApplication.getSharedPreferences().getString(USER_PHOTO,"");
    }
    public static void saveUserPhone(String userPhone){
        MyApplication.getEditor().putString(USER_PHONE,userPhone).apply();
    }
    public static String getUserPhone(){
        return MyApplication.getSharedPreferences().getString(USER_PHONE,"");
    }
    public static void saveLoginState(Boolean b){
        MyApplication.getEditor().putBoolean(LOGIN_STATE,b).apply();
    }
    public static Boolean getLoginState(){
        return MyApplication.getSharedPreferences().getBoolean(LOGIN_STATE,false);
    }
    public static void saveTemplateOnePicUrl(String url){
        MyApplication.getEditor().putString(TEMPLATE_ONE_PICURL,url).apply();
    }
    public static String getTemplateOnePicUrl(){
        return MyApplication.getSharedPreferences().getString(TEMPLATE_ONE_PICURL,"");
    }
    public static void saveUserPhotoTempPath(String userPhoto){
        MyApplication.getEditor().putString(USER_PHOTO_TEMP,userPhoto).apply();
    }
    public static String getUserPhotoTempPath(){
        return MyApplication.getSharedPreferences().getString(USER_PHOTO_TEMP,"");
    }
    public static void saveChooseColor(int color){
        MyApplication.getEditor().putInt(CHOOSE_COLOR,color).apply();
    }
    public static int getChooseColor(){
        return MyApplication.getSharedPreferences().getInt(CHOOSE_COLOR,0);
    }
}
